package org.alys114.springcloud.pmember.service;

import org.alys114.springcloud.pmember.entities.Member;
import org.alys114.springcloud.pmember.exception.MemberNotFoundException;
import org.alys114.springcloud.pmember.repository.MemberRepository;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
 * @author: Vincent.chan
 * @date: 2019/9/23 9:37
 * @version: v1.0
 * @Description: TODO<描述>
 */

@Service
public class MemberService {
    @Resource
    private MemberRepository memberRepository;

    public Member checkByMobile(String mobile){
        List<Member> members = memberRepository.findByMobile(mobile);
        if(members.size()<1){
            throw new MemberNotFoundException("会员不存在...");
        }
        return members.get(0);
    }
}
